package com.gitee.wsl.collections.delegate


/**
 * Collection type that delegates to another implementation.
 *
 * @param <T>
 * Collection item type.
 *
 * @author Matt Coley
</T> */
open class DelegatingCollection<T>(protected open val delegate:  Collection<T>) : Collection<T>  {

    override fun contains(element: T): Boolean  = delegate.contains(element)
    override fun iterator(): Iterator<T> = delegate.iterator()

    override fun containsAll(elements: Collection<T>): Boolean = delegate.containsAll(elements)

    override fun isEmpty(): Boolean  =  delegate.isEmpty()

    override val size: Int
        get() = delegate.size

    override fun equals(other: Any?): Boolean {
        return delegate.equals(other)
    }

    override fun hashCode(): Int {
        return delegate.hashCode()
    }

    override fun toString(): String {
        return delegate.toString()
    }
}

open class DelegatingMutableCollection<T>(protected open val delegate:  MutableCollection<T>) : MutableCollection<T> by delegate